import request from '@/utils/request'

// 匿名查询产品列表（公共界面）
export  function listProduct(query) {
    return request({
      url: '/credit/products/anonymousFindAll',
      method: 'get',
      params: query
    })
  }

  export  function listProducts(query) {
    return request({
      url: '/credit/products/findAll',
      method: 'get',
      params: query
    })
  }
//模糊产品查询
export function searchProduct(query){
return request({
  url: '/credit/products/searchProduct',
  method: 'get',
  params:query
})
} 
 //购买产品请求后端校验个人信息
export function verifInfo(data){
  return request({
    url: '/credit/order/verifInfo',
    method: 'post',
    data:data
    
    
  })
  } 

//匿名模糊产品查询
export function anonymousSearchProduct(query){
return request({
  url: '/credit/products/anonymousSearchProduct',
  method: 'get',
  params:query
})
}  
//模糊产品查询
export  function likeProducts(query) {
  return request({
    url: '/credit/products/findLikeProduct',
    method: 'post',
    params: query
  })
}
 // 新增产品功能
export function addProducts(data) {
  return request({
    url: '/credit/products/addproduct',
    method: 'post',
    data: data
  })
}

//根据id查询产品详细
export function getProducts(id) {
  return request({
    url: '/credit/products/' + id,
    method: 'get'
  })
}

// 修改产品
export function updateProducts(data) {
  return request({
    url: '/credit/products/updateproduct',
    method: 'put',
    data: data
  })
}

// 删除产品
export function delProducts(id) {
  return request({
    url: '/credit/products/' + id,
    method: 'delete'
  })
}

//更新状态
export function editOneType(id,enableStatus){
  return request({
    url:'/credit/products/'+id+'/'+enableStatus,
    method:'put',
  })
}

// 购买时测算金额
export function calculate(data){
  return request({
    url:'/credit/products/getMoney',
    method:'post',
    data:data
  })
}